package cn.iocoder.yudao.module.shop.info.mq;

import cn.hutool.extra.spring.SpringUtil;
import cn.iocoder.yudao.module.api.shop.info.dto.ShopInfoDTO;
import cn.iocoder.yudao.module.api.shop.info.message.ShopAuditPassMessage;
import cn.iocoder.yudao.module.api.shop.info.message.ShopInfoUpdateMessage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 店铺信息 事件生产者
 *
 * @author 山野羡民（1032694760@qq.com）
 */
@Slf4j
@Component
public class ShopInfoProducer {

    /**
     * 发送 {@link ShopAuditPassMessage} 消息
     *
     * @param shopInfo 店铺信息
     */
    public void sendShopAuditPassMessage(ShopInfoDTO shopInfo) {
        log.info("[sendShopAuditPassMessage] {}", shopInfo);
        SpringUtil.getApplicationContext().publishEvent(new ShopAuditPassMessage(shopInfo));
    }

    /**
     * 发送 {@link ShopInfoUpdateMessage} 消息
     *
     * @param shopInfo 店铺信息
     */
    public void sendShopInfoUpdateMessage(ShopInfoDTO shopInfo) {
        log.debug("[sendShopInfoUpdateMessage] {}", shopInfo);
        SpringUtil.getApplicationContext().publishEvent(new ShopInfoUpdateMessage(shopInfo));
    }

}
